<?php
/**
 * 小邮筒订单
 */
namespace soa\minpost\order\v1\common;

use soa\client;

//订单打印
class orderPrint  extends client
{
	/**
	 * 服务地址
	 * @var string
	 */
	public $service_url = 'http://mp.kuaidihelp.com/';

	/**
	 * 服务名称
	 * @var string
	 */
	protected $service_name = 'kuaidihelp_mp';

	//添加打印记录
	public function insert($uid, $platform, $agentGuid, $printData = [], $printType = 3, $extraInfo = [])
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/insert", compact('uid', "platform", "agentGuid", "printData", "printType", "extraInfo"));
	}

	//根据用户查询打印任务
	public function getByUser($uid, $platform, $limit = [], $orderBy = "id DESC", $extraInfo = [])
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/getByUser", compact('uid', "platform", "limit", "orderBy", "extraInfo"));
	}

	//根据订单查询打印任务
	public function getByOrder($orderId, $limit = [], $orderBy = "id DESC", $extraInfo = [])
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/getByOrder", compact('orderId', "limit", "orderBy", "extraInfo"));
	}

	//根据打印机查询打印任务
	public function getByAgent($agentGuid, $limit = [], $orderBy = "id DESC", $extraInfo = [])
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/getByAgent", compact('agentGuid', "limit", "orderBy", "extraInfo"));
	}

	//根据运单号查询打印任务
	public function getByWaybill($waybill, $brand = "", $limit = [], $orderBy = "id DESC", $extraInfo = [])
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/getByUser", compact('waybill', "brand", "limit", "orderBy", "extraInfo"));
	}

	//根据打印任务id查询打印任务
	public function getByTaskId($taskId)
	{
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/getByTaskId", compact('taskId'));
	}

	//创建打印任务成功
	public function createTaskSuccess($taskId){
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/createTaskSuccess", compact('taskId'));
	}

	//打印成功
	public function printSuccess($taskId){
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/printSuccess", compact('taskId'));
	}

	//打印失败
	public function printFail($taskId,$errMsg = ""){
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/printFail", compact('taskId',"errMsg"));
	}

	//底单成功
	public function proofSuccess($taskId,$proofImg){
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/proofSuccess", compact('taskId',"proofImg"));
	}

	//底单失败
	public function proofFail($taskId,$errMsg = ""){
		return $this->post("api/cloudPrint/order/v1/common/orderPrint/proofFail", compact('taskId',"errMsg"));
	}
}